<%@page import="javax.xml.soap.Detail"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>

<%
         request.setCharacterEncoding("UTF-8");
%>
<%@ page import="java.sql.*" %>
<html>
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
                <title>DETAIL</title>
	<style type="text/css">
                       body{
                           background-image: url('photo/detail2.JPG');
                           background-size:cover;  
                         }
                    </style>

        </head>
<body scroll = no>

<%
Statement sql;
Connection con;
ResultSet rs;
ResultSet rs2;
String neirong=null;
int id=Integer.parseInt(request.getParameter("id")); 
   try{
       Class.forName("com.mysql.jdbc.Driver");
       }
       catch(Exception e){
    	   out.print("加载驱动错误");
       };
       
    	try{ 
    		int replyid=0;
    	
	      String uri="jdbc:mysql://localhost:3306/sharing"; 
          
    	   con = DriverManager.getConnection(uri,"root","ZHUBI123.");
    	   String condition="select * from discuss where id = '"+ id +"'";
    	   
    	
    	   sql=con.createStatement();
    	   rs=sql.executeQuery(condition);
    	
    	   while(rs.next())
    	   { 	
		out.println("</br>");
		out.println("</br>");
		out.println("</br>");
		out.println("</br>");
		out.println("</br>");
		out.println("</br>");   
		out.println("</br>");
		out.println("</br>"); 
		neirong=rs.getString(4);
		out.println("楼主:\n");
	        out.print("</br>");
		out.print("\t"+rs.getString(4));
     	   }
       	   out.print("<tr>");
    	   out.print("<hr>");
    	   out.print("</tr>");

 	   String condition2="select * from reply where reply = '"+ id +"'"; 
    		rs2=sql.executeQuery(condition2); 
    	   while(rs2.next())
    	   { 
	       out.print("<table>");
    	       out.print("<tr>");
    	       out.print("<td>用户" + rs2.getString(1) + "的回复：</td>");
    	       out.print("<td>" + rs2.getString(2) + "</td>");
    	       out.print("</tr>");
    	       out.print("<tr>");
	      out.print("<td>  时间：" + rs2.getString(3) + "</td>");
            out.print("</tr>");
    	       out.print("</table>");
    	   int reply=Integer.parseInt(rs2.getString(5));//提取回复贴的id；
    	   out.print("<a href=delete.jsp?id="+id+
        		   "&replyid="+reply+">删除该回复</a>");

	  }
	}
	catch(Exception e) {

                 out.println("详细内容显示错误");};
       %>
   
     
     <form name=form2 action=SaveRevert.jsp?id=<%=id%> method="post"
      onsubmit="return checkForm(this);">
      <table border=1>
　　　					
　　　				<tr>
　　　					<td align=center>回复该帖子</td>
　　　					<td>
　　　						<textarea rows=15 cols=110 name=content></textarea>
　　　					</td>
　　　				</tr>
　　　				<tr align=center>
　　　					<td colspan=2>
　　　						<input type=submit value=回复 name=send>
　　　						<input type=reset value=重置>

	
   
  </body>
</html>
